#include "laurin-utils.h"
#include <netinet/ether.h>

const char* getReadableIP(u_int32_t ip, bool resolve)
{
	return libnet_addr2name4(ip, (resolve) ? LIBNET_RESOLVE : LIBNET_DONT_RESOLVE);
}

const char* getReadableMAC(u_int8_t mac[ETH_ALEN])
{
	// from netinet/ether.h
	return  ether_ntoa((struct ether_addr*)mac);
}


bool areMACEquals(u_int8_t* op1, u_int8_t* op2)
{
	if(!op1 || !op2 )
		return false;

	for(int i = 0; i < ETH_ALEN; i++)
		if(*(op1 + i) != *(op2 + i))
			return false;

	return true;
}

